/*
 * case design:
 * common symbols test: Extends, Constructor, Namespace, Fields, Methods, Statics.
 * no Extends; 
 * no Constructor;
 * constrcutor paramters: no parameter, some parameters.
 * 
 */

/*
 * test case 1
 */
Class.create(
{
	Namespace : "SuperType",
	Constructor : function() {
		alert("SuperType Constructor");
	},
	Methods : {
		sayName : function() {
			alert("say name");
		}
	}
});

Class.create(
{
	Namespace : "a.SubType",
	Extends : SuperType,
	Constructor : function() {
		this.Super();
	},
	Methods : {
		sayName2 : function() {
			this.sayName();
		}
	}
});

var s = new a.SubType();
s.sayName2();

/*
 * test case 2
 */
Class.create(
{
	Namespace : "SuperType2",
	Constructor : function(name) {
		this._name = name;
	},
	Fields : {
		_name : null
	},
	Methods : {
		sayName : function() {
			alert(this._name);
		}
	}
});

Class.create(
{
	Namespace : "a.SubType2",
	Extends : SuperType2,
	Constructor : function(name, age) {
		this.Super(name);
		this._age = age;
	},
	Fields : {
		_age : -1
	},
	Methods : {
		sayAge : function() {
			alert(this._age);
		}
	}
});

var super2 = new SuperType2("John");
super2.sayName(); // John
var sub2 = new a.SubType2("Mike", 23);
sub2.sayName(); // Mike
sub2.sayAge(); // 23

alert("super2 instanceof SuperType2=" + (super2 instanceof SuperType2)); // true
alert("super2 instanceof a.SubType2=" + (super2 instanceof a.SubType2)); // false
alert("super2.constructor===SuperType2:" + (super2.constructor === SuperType2)); // true
alert("sub2 instanceof a.SubType2=" + (sub2 instanceof a.SubType2)); // true
alert("sub2 instanceof SuperType2=" + (sub2 instanceof SuperType2)); // true
alert("sub2.constructor===SubType2:" + (sub2.constructor===a.SubType2)); // true

/*
 * test case 3
 */
Class.create(
{
	Namespace : "SuperType3",
	Fields : {
		_age : -1
	},
	Methods : {
		setAge : function(age) {
			this._age = age;
		},
		sayAge : function() {
			alert(this._age);
		}
	},
	Statics : {
		PI : 3.1415926,
		sqrt : function(val) {
			return val * val;
		}
	}
});

var super3 = new SuperType3();
super3.setAge(24);
super3.sayAge(); // 24
alert(SuperType3.PI);
alert(SuperType3.sqrt(6));
